using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.Contracts;

namespace FoundationLib.Mail 
{
	/// <summary>
	/// This interface provides functionality for processing email templates.
	/// </summary>
	[ContractClass(typeof(MailTemplateContract))]
	public interface IMailTemplate : IDisposable
	{
		/// <summary>
		/// Gets or sets the mail connector to be used while processing this template.
		/// </summary>
		IMailConnector Connector
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the template content.
		/// </summary>
		string Contents
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the data to be used with this template.
		/// </summary>
		MailData Data
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the template parser.
		/// </summary>
		TemplateParser Parser
		{
			get;
			set;
		}

		/// <summary>
		/// Gets a list of target email addresses.
		/// </summary>
		IList<string> MailRecipients
		{
			get;
		}

		/// <summary>
		/// Processes this template by replacing all template variables with the data
		/// provided and sending the mail to the given recipient.
		/// </summary>
		/// <exception cref="InvalidOperationException">This operation cannot be performed because its instance 
		/// is in an invalid state.</exception>
		void Process();
	}

}